home *** CD-ROM | disk | FTP | other *** search
- /* $XConsortium: XrmI.h,v 1.7 91/04/23 18:25:52 rws Exp $ */
- /*
-
- Copyright 1990 by the Massachusetts Institute of Technology
-
- Permission to use, copy, modify, distribute, and sell this software and its
- documentation for any purpose is hereby granted without fee, provided that
- the above copyright notice appear in all copies and that both that
- copyright notice and this permission notice appear in supporting
- documentation, and that the name of M.I.T. not be used in advertising or
- publicity pertaining to distribution of the software without specific,
- written prior permission. M.I.T. makes no representations about the
- suitability of this software for any purpose. It is provided "as is"
- without express or implied warranty.
-
- */
-
- /*
- * Macros to abstract out reading the file, and getting its size.
- *
- * You may need to redefine these for various other operating systems.
- */
-
- #include <X11/Xos.h>
- #include <sys/stat.h>
-
- #ifdef MSDOS
- #define OpenFile(name) open((name), O_RDONLY | O_BINARY)
- #else
- #define OpenFile(name) open((name), O_RDONLY)
- #endif
-
- #define CloseFile(fd) close((fd))
- #define ReadFile(fd,buf,size) read((fd), (buf), (size))
- #define GetSizeOfFile(name,size) \
- { \
- struct stat status_buffer; \
- if ( (stat((name), &status_buffer)) == -1 ) \
- size = -1; \
- else \
- size = status_buffer.st_size; \
- }
-